// var axios = require('axios');
// var cheerio = require('cheerio')

// axios({
//     method: 'get',
//     url: 'http://www.baidu.com',
//     // responseType: 'stream'
//   })
//   .then(function (response) {
//     // console.log(response.data);
//     var $ = cheerio.load(response.data);
//     var html = $('#s_tab').html();
//     console.log(html);
//   });

var Crawler = require("crawler");

var c = new Crawler({
  maxConnections: 10,
  // This will be called for each crawled page
  callback: function (error, res, done) {
    if (error) {
      console.log(error);
    } else {
      var $ = res.$;
      // $ is Cheerio by default
      //a lean implementation of core jQuery designed specifically for the server
      // console.log($("title").text());
      // console.log(res.body);
      var html = $('#mMenu').html();
      console.log(html);
    }
    done();
  }
});

// Queue just one URL, with default callback
c.queue('http://www.baidu.com');